package com.bw.liveplay.common.mvvm.view

import android.content.Intent
import android.os.Bundle
import android.widget.ImageView
import android.widget.TextView
import com.bw.liveplay.BR
import com.bw.liveplay.R
import com.bw.liveplay.common.mvvm.viewmodel.CommentViewModel
import com.bw.liveplay.common.network.LoadImage
import com.bw.liveplay.databinding.ActivityCommentBinding
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

class CommentActivity : BaseActivity<ActivityCommentBinding, CommentViewModel>() {
    var commentUserimg : ImageView?=null
    var commentUsername : TextView?=null
    var commentComment : TextView?=null
    var commentGsy : StandardGSYVideoPlayer?=null
    var heads: String ?=null
    var coments: String  ?= null
    var gsys: String  ?= null
    var usernames: String  ?= null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        commentUserimg = findViewById(R.id.comment_userimg)
        commentUsername = findViewById(R.id.comment_username)
        commentComment =  findViewById(R.id.comment_comment);
        commentGsy = findViewById(R.id.comment_gsy);


        heads = intent!!.extras!!.get("head") as String?
        coments = intent!!.extras!!.get("coment") as String?
        usernames = intent!!.extras!!.get("username") as String?
        gsys = intent!!.extras!!.get("gsy") as String?

        LoadImage.loadcrile(heads!!,commentUserimg!!)
        commentUsername!!.text = usernames
        commentComment!!.text = coments
        commentGsy!!.setUp(gsys,false,"视频")

    }



    override fun bindLayout(): Int {
        return R.layout.activity_comment
    }

    override fun initVerable(): Int {
        return BR.vm
    }

    override fun onResume() {
        super.onResume()
        vm.initData()
    }

}